<template>
    <div>
        <div class="crumbs">
            <el-breadcrumb separator="/">
                <el-breadcrumb-item>
                    <i class="el-icon-lx-calendar"></i> 客户
                </el-breadcrumb-item>
                <el-breadcrumb-item>添加客户</el-breadcrumb-item>
            </el-breadcrumb>
        </div>
        <div class="container" >
            <div class="form-box1" style="margin-left: 30%;margin-right: 30%;margin-top: 5%;">
                <br><br>
                <el-form ref="form" :model="form" label-width="100px" style="margin-left: 120px;">
                    <el-form-item label="客户名称：">
                        <el-input v-model="form.name" style="width: 250px;"></el-input>
                    </el-form-item>
                    <el-form-item label="公司地址：">
                        <el-input v-model="form.address" style="width: 250px;"></el-input>
                    </el-form-item>
                    <el-form-item label="联系人姓名：">
                        <el-input v-model="form.contacts" style="width: 250px;"></el-input>
                    </el-form-item>
                    <el-form-item label="联系人手机：">
                        <el-input v-model="form.phone" style="width: 250px;"></el-input>
                    </el-form-item>
                    
                    <el-form-item>
                        <el-button type="primary" @click="tianjia">添加客户</el-button>
                        <el-button>取消</el-button>
                    </el-form-item>
                </el-form>
            </div>
        </div>
    </div>
</template>

<script>
    import{ addcustomer } from '../../api/api'
export default {
    name: 'baseform',
    data() {
        return {
            form: {
                name: '',//客户名称
                phone:'',
                address:'',
                contacts:'',//联系人
            }
        };
    },
    methods: {
        tianjia(){
            var params = {
                cus_com:this.form.name,
                address:this.form.address,
                contacts:this.form.contacts,
                phone:this.form.phone,
            }
            addcustomer(params).then(res=>{
                this.$message.success(res.message);
            })
            
        },
    },
    mounted() {
    },
};
</script>

<style>
.form-box1 {
        border: honeydew 1px solid;
        border-radius: 4px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04);
        margin-left: 30%;
        margin-right: 30%;
        margin-top: 5%;
    }
</style>